package net.kts.story.menu;

import net.kts.main.R;
import android.content.Context;
import android.view.GestureDetector;
import android.view.GestureDetector.OnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class StoryMenuOnGestureListener implements OnGestureListener, OnTouchListener{
	private View button;
	private Animation animation;
	private GestureDetector gestureDetectorl;
	private Animation animation_out;
	
	public StoryMenuOnGestureListener(View button, Context context) {
		super();
		this.button = button;
		this.animation = AnimationUtils.loadAnimation(context, R.anim.story_menu);
		this.animation_out = AnimationUtils.loadAnimation(context, R.anim.story_menu_out);
		this.gestureDetectorl = new GestureDetector(this);
	}

	@Override
	public boolean onDown(MotionEvent e) {
		return false;
	}

	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		return false;
	}

	@Override
	public void onLongPress(MotionEvent e) {
		
	}
	

	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
			float distanceY) {
		return false;
	}

	@Override
	public void onShowPress(MotionEvent e) {
		button.startAnimation(animation);
		
	}

	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		
		return false;
	}

	@Override
	public boolean onTouch(View v, MotionEvent event) {
		if(event.getAction() == MotionEvent.ACTION_DOWN)
			return this.gestureDetectorl.onTouchEvent(event);
		return false;
	}
}
